package com.wm.dao;

import com.wm.entity.RbacPerm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface PermDao {
    /**
     *
     * @author L
     *
     * 根据角色ID查询权限列表
     */
    @Select({"select p.name from rbac_perm p ,rbac_role_perm rp ",
            " where p.id=rp.perm_id and rp.role_id =#{roleId}"}   )
    List<RbacPerm> getByRoleId(int roleId);


    /**
     * @author L
     */

    @Select("select * from v_perm where user_id=#{userId} and type='a'")
    List<RbacPerm> getPermByUserId(int userId);

    @Select("select * from rbac_perm where link=#{link} and type='a' ")
    RbacPerm getByLink(String link);
}
